﻿using System;
using System.Collections.Generic;
using ZyGames.DZPocker.Model;
using ZyGames.Framework.Cache.Generic;
using ZyGames.Framework.Game.Cache;
using ZyGames.Framework.Game.Context;
using ZyGames.Framework.Game.Contract;
using ZyGames.Framework.Game.Contract.Action;
using ZyGames.Framework.Game.Lang;
using ZyGames.Framework.Game.Service;
using System.Linq;
using ZyGames.DZPocker.Bll.Logic;
using ZyGames.DZPocker.Script;

namespace ZyGames.DZPocker.Script.CsScript.Action
{
	/// <summary>
	/// 广播玩家的跟注选择
	/// </summary>
	public class Action30008 : BaseAction
	{
		private int _tableId;
		private int _userId;
		private int _posId;
		/// <summary>
		/// 当前回合下注的总数量
		/// </summary>
		private int _chip;
		/// <summary>
		/// PositionType  1、加注 2、AllIn 3、弃牌 4、看牌 5、跟注
		/// </summary>
		private int _betType;
		/// <summary>
		/// 玩家的剩余筹码
		/// </summary>
		private int _leftChip;
		public Action30008(HttpGet actionGetter)
			: base((short)ActionType.DZBrocastPlayBetChoose, actionGetter)
		{
		}
		public override bool GetUrlElement()
		{
			if (httpGet.GetInt("TableID", ref _tableId) &&
				httpGet.GetInt("UserID", ref _userId) &&
				httpGet.GetInt("PosID", ref _posId) &&
				httpGet.GetInt("Chip", ref _chip) &&
				httpGet.GetInt("BetType", ref _betType) &&
				httpGet.GetInt("LeftChip", ref _leftChip))
			{
				return true;
			}
			return false;
		}

		public override bool TakeAction()
		{
			return true;
		}

		public override void BuildPacket()
		{
			this.PushIntoStack(_tableId);
			this.PushIntoStack(_userId);
			this.PushIntoStack(_posId);
			this.PushIntoStack(_chip);
			this.PushIntoStack(_betType);
			this.PushIntoStack(_leftChip);
		}
	}
}
